package org.squirrel.modules.bigscreen.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.squirrel.common.api.vo.Result;
import org.squirrel.common.system.base.controller.SquirrelController;
import org.squirrel.modules.bigscreen.dto.ReportDto;
import org.squirrel.modules.bigscreen.entity.Report;
import org.squirrel.modules.bigscreen.service.ReportService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestController
@Api(tags = "报表数据管理")
@RequestMapping("/report")
public class ReportController extends SquirrelController< Report, ReportService> {

    @Autowired
    private ReportService reportService;

    /**
     * 复制
     * 
     * @param dto
     * @return
     */
    @ApiOperation(value = "复制", notes = "复制")
    @PostMapping("/copy")
    public  Result<?> copy(@RequestBody ReportDto dto) {
    	try {
	        reportService.copy(dto);
	        return Result.OK("复制成功",dto);
    	}catch(Exception e) {
    		log.error("复制异常", e);
			return Result.error("复制失败,原因:" + e.getMessage());
    	}
    }
}
